package com.hnevc.jdbc;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.util.Calendar;
import java.sql.Date;


public class JDBCCallableStatementDemo {

	public static void main(String[] args) throws Exception {
		Class.forName("com.mysql.jdbc.Driver");
		Connection conn = DriverManager
				.getConnection("jdbc:mysql://localhost:3306/jdbc"
								,"root","123456");
		System.out.println("连接成功");
		CallableStatement cstmt = conn.prepareCall("{call addUserdetails(?,?,?,?,?)}");
		cstmt.setInt(1,15);
		cstmt.setString(2, "小王");
		cstmt.setString(3, "123456");
		cstmt.setString(4, "xiaowang@163.com");
		cstmt.setDate(5,new Date(Calendar.getInstance().getTimeInMillis()));
		cstmt.execute();
		cstmt.close();
		conn.close();
		System.out.println("OK");
		
		

	}

}
